package org.example.demo14_observe;

public class Client {
    public static void main(String[] args) {
        Sensor sensor = new Sensor();
        // 模拟温度变化

        // 创建并注册各种响应设备
        sensor.attach(new Alarm());
        sensor.attach(new Light());
        sensor.attach(new EmergencyDoor());
        sensor.attach(new InsulationDoor());

        sensor.setTemperature(45); // 某一指定温度，各设备做出相应反应

    }
}
